#pragma once
// MESSAGE SET_PID_SPEED PACKING

#define MAVLINK_MSG_ID_SET_PID_SPEED 198

MAVPACKED(
typedef struct __mavlink_set_pid_speed_t {
 int16_t rol_pid_p; /*<  rol_pid_p*/
 int16_t rol_pid_i; /*<  rol_pid_i*/
 int16_t rol_pid_d; /*<  rol_pid_d*/
 int16_t pit_pid_p; /*<  pit_pid_p*/
 int16_t pit_pid_i; /*<  pit_pid_i*/
 int16_t pit_pid_d; /*<  pit_pid_d*/
 int16_t yaw_pid_p; /*<  yaw_pid_p*/
 int16_t yaw_pid_i; /*<  yaw_pid_i*/
 int16_t yaw_pid_d; /*<  yaw_pid_d*/
}) mavlink_set_pid_speed_t;

#define MAVLINK_MSG_ID_SET_PID_SPEED_LEN 18
#define MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN 18
#define MAVLINK_MSG_ID_198_LEN 18
#define MAVLINK_MSG_ID_198_MIN_LEN 18

#define MAVLINK_MSG_ID_SET_PID_SPEED_CRC 117
#define MAVLINK_MSG_ID_198_CRC 117



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_SET_PID_SPEED { \
    198, \
    "SET_PID_SPEED", \
    9, \
    {  { "rol_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid_speed_t, rol_pid_p) }, \
         { "rol_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid_speed_t, rol_pid_i) }, \
         { "rol_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid_speed_t, rol_pid_d) }, \
         { "pit_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid_speed_t, pit_pid_p) }, \
         { "pit_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid_speed_t, pit_pid_i) }, \
         { "pit_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid_speed_t, pit_pid_d) }, \
         { "yaw_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid_speed_t, yaw_pid_p) }, \
         { "yaw_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid_speed_t, yaw_pid_i) }, \
         { "yaw_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid_speed_t, yaw_pid_d) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_SET_PID_SPEED { \
    "SET_PID_SPEED", \
    9, \
    {  { "rol_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid_speed_t, rol_pid_p) }, \
         { "rol_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid_speed_t, rol_pid_i) }, \
         { "rol_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid_speed_t, rol_pid_d) }, \
         { "pit_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid_speed_t, pit_pid_p) }, \
         { "pit_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid_speed_t, pit_pid_i) }, \
         { "pit_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid_speed_t, pit_pid_d) }, \
         { "yaw_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid_speed_t, yaw_pid_p) }, \
         { "yaw_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid_speed_t, yaw_pid_i) }, \
         { "yaw_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid_speed_t, yaw_pid_d) }, \
         } \
}
#endif

/**
 * @brief Pack a set_pid_speed message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param rol_pid_p  rol_pid_p
 * @param rol_pid_i  rol_pid_i
 * @param rol_pid_d  rol_pid_d
 * @param pit_pid_p  pit_pid_p
 * @param pit_pid_i  pit_pid_i
 * @param pit_pid_d  pit_pid_d
 * @param yaw_pid_p  yaw_pid_p
 * @param yaw_pid_i  yaw_pid_i
 * @param yaw_pid_d  yaw_pid_d
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid_speed_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int16_t rol_pid_p, int16_t rol_pid_i, int16_t rol_pid_d, int16_t pit_pid_p, int16_t pit_pid_i, int16_t pit_pid_d, int16_t yaw_pid_p, int16_t yaw_pid_i, int16_t yaw_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID_SPEED_LEN];
    _mav_put_int16_t(buf, 0, rol_pid_p);
    _mav_put_int16_t(buf, 2, rol_pid_i);
    _mav_put_int16_t(buf, 4, rol_pid_d);
    _mav_put_int16_t(buf, 6, pit_pid_p);
    _mav_put_int16_t(buf, 8, pit_pid_i);
    _mav_put_int16_t(buf, 10, pit_pid_d);
    _mav_put_int16_t(buf, 12, yaw_pid_p);
    _mav_put_int16_t(buf, 14, yaw_pid_i);
    _mav_put_int16_t(buf, 16, yaw_pid_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID_SPEED_LEN);
#else
    mavlink_set_pid_speed_t packet;
    packet.rol_pid_p = rol_pid_p;
    packet.rol_pid_i = rol_pid_i;
    packet.rol_pid_d = rol_pid_d;
    packet.pit_pid_p = pit_pid_p;
    packet.pit_pid_i = pit_pid_i;
    packet.pit_pid_d = pit_pid_d;
    packet.yaw_pid_p = yaw_pid_p;
    packet.yaw_pid_i = yaw_pid_i;
    packet.yaw_pid_d = yaw_pid_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID_SPEED_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID_SPEED;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
}

/**
 * @brief Pack a set_pid_speed message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param rol_pid_p  rol_pid_p
 * @param rol_pid_i  rol_pid_i
 * @param rol_pid_d  rol_pid_d
 * @param pit_pid_p  pit_pid_p
 * @param pit_pid_i  pit_pid_i
 * @param pit_pid_d  pit_pid_d
 * @param yaw_pid_p  yaw_pid_p
 * @param yaw_pid_i  yaw_pid_i
 * @param yaw_pid_d  yaw_pid_d
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid_speed_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int16_t rol_pid_p,int16_t rol_pid_i,int16_t rol_pid_d,int16_t pit_pid_p,int16_t pit_pid_i,int16_t pit_pid_d,int16_t yaw_pid_p,int16_t yaw_pid_i,int16_t yaw_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID_SPEED_LEN];
    _mav_put_int16_t(buf, 0, rol_pid_p);
    _mav_put_int16_t(buf, 2, rol_pid_i);
    _mav_put_int16_t(buf, 4, rol_pid_d);
    _mav_put_int16_t(buf, 6, pit_pid_p);
    _mav_put_int16_t(buf, 8, pit_pid_i);
    _mav_put_int16_t(buf, 10, pit_pid_d);
    _mav_put_int16_t(buf, 12, yaw_pid_p);
    _mav_put_int16_t(buf, 14, yaw_pid_i);
    _mav_put_int16_t(buf, 16, yaw_pid_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID_SPEED_LEN);
#else
    mavlink_set_pid_speed_t packet;
    packet.rol_pid_p = rol_pid_p;
    packet.rol_pid_i = rol_pid_i;
    packet.rol_pid_d = rol_pid_d;
    packet.pit_pid_p = pit_pid_p;
    packet.pit_pid_i = pit_pid_i;
    packet.pit_pid_d = pit_pid_d;
    packet.yaw_pid_p = yaw_pid_p;
    packet.yaw_pid_i = yaw_pid_i;
    packet.yaw_pid_d = yaw_pid_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID_SPEED_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID_SPEED;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
}

/**
 * @brief Encode a set_pid_speed struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param set_pid_speed C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid_speed_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_pid_speed_t* set_pid_speed)
{
    return mavlink_msg_set_pid_speed_pack(system_id, component_id, msg, set_pid_speed->rol_pid_p, set_pid_speed->rol_pid_i, set_pid_speed->rol_pid_d, set_pid_speed->pit_pid_p, set_pid_speed->pit_pid_i, set_pid_speed->pit_pid_d, set_pid_speed->yaw_pid_p, set_pid_speed->yaw_pid_i, set_pid_speed->yaw_pid_d);
}

/**
 * @brief Encode a set_pid_speed struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param set_pid_speed C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid_speed_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_pid_speed_t* set_pid_speed)
{
    return mavlink_msg_set_pid_speed_pack_chan(system_id, component_id, chan, msg, set_pid_speed->rol_pid_p, set_pid_speed->rol_pid_i, set_pid_speed->rol_pid_d, set_pid_speed->pit_pid_p, set_pid_speed->pit_pid_i, set_pid_speed->pit_pid_d, set_pid_speed->yaw_pid_p, set_pid_speed->yaw_pid_i, set_pid_speed->yaw_pid_d);
}

/**
 * @brief Send a set_pid_speed message
 * @param chan MAVLink channel to send the message
 *
 * @param rol_pid_p  rol_pid_p
 * @param rol_pid_i  rol_pid_i
 * @param rol_pid_d  rol_pid_d
 * @param pit_pid_p  pit_pid_p
 * @param pit_pid_i  pit_pid_i
 * @param pit_pid_d  pit_pid_d
 * @param yaw_pid_p  yaw_pid_p
 * @param yaw_pid_i  yaw_pid_i
 * @param yaw_pid_d  yaw_pid_d
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_set_pid_speed_send(mavlink_channel_t chan, int16_t rol_pid_p, int16_t rol_pid_i, int16_t rol_pid_d, int16_t pit_pid_p, int16_t pit_pid_i, int16_t pit_pid_d, int16_t yaw_pid_p, int16_t yaw_pid_i, int16_t yaw_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID_SPEED_LEN];
    _mav_put_int16_t(buf, 0, rol_pid_p);
    _mav_put_int16_t(buf, 2, rol_pid_i);
    _mav_put_int16_t(buf, 4, rol_pid_d);
    _mav_put_int16_t(buf, 6, pit_pid_p);
    _mav_put_int16_t(buf, 8, pit_pid_i);
    _mav_put_int16_t(buf, 10, pit_pid_d);
    _mav_put_int16_t(buf, 12, yaw_pid_p);
    _mav_put_int16_t(buf, 14, yaw_pid_i);
    _mav_put_int16_t(buf, 16, yaw_pid_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_SPEED, buf, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
#else
    mavlink_set_pid_speed_t packet;
    packet.rol_pid_p = rol_pid_p;
    packet.rol_pid_i = rol_pid_i;
    packet.rol_pid_d = rol_pid_d;
    packet.pit_pid_p = pit_pid_p;
    packet.pit_pid_i = pit_pid_i;
    packet.pit_pid_d = pit_pid_d;
    packet.yaw_pid_p = yaw_pid_p;
    packet.yaw_pid_i = yaw_pid_i;
    packet.yaw_pid_d = yaw_pid_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_SPEED, (const char *)&packet, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
#endif
}

/**
 * @brief Send a set_pid_speed message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_set_pid_speed_send_struct(mavlink_channel_t chan, const mavlink_set_pid_speed_t* set_pid_speed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_set_pid_speed_send(chan, set_pid_speed->rol_pid_p, set_pid_speed->rol_pid_i, set_pid_speed->rol_pid_d, set_pid_speed->pit_pid_p, set_pid_speed->pit_pid_i, set_pid_speed->pit_pid_d, set_pid_speed->yaw_pid_p, set_pid_speed->yaw_pid_i, set_pid_speed->yaw_pid_d);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_SPEED, (const char *)set_pid_speed, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
#endif
}

#if MAVLINK_MSG_ID_SET_PID_SPEED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_set_pid_speed_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int16_t rol_pid_p, int16_t rol_pid_i, int16_t rol_pid_d, int16_t pit_pid_p, int16_t pit_pid_i, int16_t pit_pid_d, int16_t yaw_pid_p, int16_t yaw_pid_i, int16_t yaw_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int16_t(buf, 0, rol_pid_p);
    _mav_put_int16_t(buf, 2, rol_pid_i);
    _mav_put_int16_t(buf, 4, rol_pid_d);
    _mav_put_int16_t(buf, 6, pit_pid_p);
    _mav_put_int16_t(buf, 8, pit_pid_i);
    _mav_put_int16_t(buf, 10, pit_pid_d);
    _mav_put_int16_t(buf, 12, yaw_pid_p);
    _mav_put_int16_t(buf, 14, yaw_pid_i);
    _mav_put_int16_t(buf, 16, yaw_pid_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_SPEED, buf, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
#else
    mavlink_set_pid_speed_t *packet = (mavlink_set_pid_speed_t *)msgbuf;
    packet->rol_pid_p = rol_pid_p;
    packet->rol_pid_i = rol_pid_i;
    packet->rol_pid_d = rol_pid_d;
    packet->pit_pid_p = pit_pid_p;
    packet->pit_pid_i = pit_pid_i;
    packet->pit_pid_d = pit_pid_d;
    packet->yaw_pid_p = yaw_pid_p;
    packet->yaw_pid_i = yaw_pid_i;
    packet->yaw_pid_d = yaw_pid_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_SPEED, (const char *)packet, MAVLINK_MSG_ID_SET_PID_SPEED_MIN_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_LEN, MAVLINK_MSG_ID_SET_PID_SPEED_CRC);
#endif
}
#endif

#endif

// MESSAGE SET_PID_SPEED UNPACKING


/**
 * @brief Get field rol_pid_p from set_pid_speed message
 *
 * @return  rol_pid_p
 */
static inline int16_t mavlink_msg_set_pid_speed_get_rol_pid_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field rol_pid_i from set_pid_speed message
 *
 * @return  rol_pid_i
 */
static inline int16_t mavlink_msg_set_pid_speed_get_rol_pid_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field rol_pid_d from set_pid_speed message
 *
 * @return  rol_pid_d
 */
static inline int16_t mavlink_msg_set_pid_speed_get_rol_pid_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field pit_pid_p from set_pid_speed message
 *
 * @return  pit_pid_p
 */
static inline int16_t mavlink_msg_set_pid_speed_get_pit_pid_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  6);
}

/**
 * @brief Get field pit_pid_i from set_pid_speed message
 *
 * @return  pit_pid_i
 */
static inline int16_t mavlink_msg_set_pid_speed_get_pit_pid_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  8);
}

/**
 * @brief Get field pit_pid_d from set_pid_speed message
 *
 * @return  pit_pid_d
 */
static inline int16_t mavlink_msg_set_pid_speed_get_pit_pid_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  10);
}

/**
 * @brief Get field yaw_pid_p from set_pid_speed message
 *
 * @return  yaw_pid_p
 */
static inline int16_t mavlink_msg_set_pid_speed_get_yaw_pid_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  12);
}

/**
 * @brief Get field yaw_pid_i from set_pid_speed message
 *
 * @return  yaw_pid_i
 */
static inline int16_t mavlink_msg_set_pid_speed_get_yaw_pid_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  14);
}

/**
 * @brief Get field yaw_pid_d from set_pid_speed message
 *
 * @return  yaw_pid_d
 */
static inline int16_t mavlink_msg_set_pid_speed_get_yaw_pid_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  16);
}

/**
 * @brief Decode a set_pid_speed message into a struct
 *
 * @param msg The message to decode
 * @param set_pid_speed C-struct to decode the message contents into
 */
static inline void mavlink_msg_set_pid_speed_decode(const mavlink_message_t* msg, mavlink_set_pid_speed_t* set_pid_speed)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    set_pid_speed->rol_pid_p = mavlink_msg_set_pid_speed_get_rol_pid_p(msg);
    set_pid_speed->rol_pid_i = mavlink_msg_set_pid_speed_get_rol_pid_i(msg);
    set_pid_speed->rol_pid_d = mavlink_msg_set_pid_speed_get_rol_pid_d(msg);
    set_pid_speed->pit_pid_p = mavlink_msg_set_pid_speed_get_pit_pid_p(msg);
    set_pid_speed->pit_pid_i = mavlink_msg_set_pid_speed_get_pit_pid_i(msg);
    set_pid_speed->pit_pid_d = mavlink_msg_set_pid_speed_get_pit_pid_d(msg);
    set_pid_speed->yaw_pid_p = mavlink_msg_set_pid_speed_get_yaw_pid_p(msg);
    set_pid_speed->yaw_pid_i = mavlink_msg_set_pid_speed_get_yaw_pid_i(msg);
    set_pid_speed->yaw_pid_d = mavlink_msg_set_pid_speed_get_yaw_pid_d(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_SET_PID_SPEED_LEN? msg->len : MAVLINK_MSG_ID_SET_PID_SPEED_LEN;
        memset(set_pid_speed, 0, MAVLINK_MSG_ID_SET_PID_SPEED_LEN);
    memcpy(set_pid_speed, _MAV_PAYLOAD(msg), len);
#endif
}
